//
//  NSDictionary+ZZUtil.m
//  OCFrame
//
//  Created by hfzhangzhang on 2016/12/19.
//  Copyright © 2016年 hfzhangzhang. All rights reserved.
//

#import "NSDictionary+ZZUtil.h"

@implementation NSDictionary (ZZUtil)

@end



@implementation NSMutableDictionary (ZZUtil)

-(void)zz_setObjectWithProtectedMode:(id)anObject forKey:(id<NSCopying>)aKey{
    if (anObject && ![anObject isKindOfClass:[NSNull class]]) {
        [self setObject:anObject forKey:aKey];
    }
}

-(void)zz_setObjectFromDictionary:(NSDictionary*)dic{
    if (!dic || [dic isKindOfClass:[NSNull class]]) {
        return;
    }
    for (id key in dic.allKeys) {
        id value = [dic objectForKey:key];
        if (value && ![value isKindOfClass:[NSNull class]]) {
            [self zz_setObjectWithProtectedMode:value forKey:key];
        }
    }
}
@end
